<!DOCTYPE html>
<html xmlns:th="http://www.thymeleaf.org">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="Cache-Control" content="no-cache, no-store, must-revalidate"/>
    <meta http-equiv="Pragma" content="no-cache"/>
    <meta http-equiv="Expires" content="0"/>
    <title>编辑收货地址 - 钢域云贸</title>
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1"/>
    <meta http-equiv="Content-type" content="text/html; charset=utf-8"/>
    <meta name="viewport" content="width=device-width,minimum-scale=1.0,maximum-scale=1.0">
    <link rel="icon" href="/uploads/logo.png" type="image/x-icon"/>
    <link rel="shortcut icon" href="/uploads/logo.png" type="image/x-icon"/>
    <link rel="stylesheet" type="text/css" href="/css/public.css"/>
    <script src="https://code.jquery.com/jquery-3.6.0.min.js"></script>
    <script src="https://cdn.tailwindcss.com"></script>
    <style>
        body {
            background-color: #f5f5f5;
            font-family: Arial, sans-serif;
            margin: 0;
            padding: 20px;
        }
        .container {
            max-width: 800px;
            margin: 0 auto;
        }
        h2 {
            font-size: 24px;
            color: #333;
            margin-bottom: 20px;
        }
        .receipt-form {
            background-color: #fff;
            padding: 20px;
            border-radius: 8px;
            box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
        }
        .form-group {
            margin-bottom: 15px;
        }
        .form-group label {
            display: block;
            font-size: 14px;
            color: #666;
            margin-bottom: 5px;
        }
        .form-group input, .form-group textarea {
            width: 100%;
            padding: 8px;
            border: 1px solid #ddd;
            border-radius: 4px;
            font-size: 14px;
            box-sizing: border-box;
        }
        .form-group textarea {
            height: 80px;
            resize: none;
        }
        .form-group input[type="checkbox"] {
            width: auto;
            margin-right: 5px;
        }
        .form-actions {
            margin-top: 20px;
        }
        .btn-submit {
            background-color: #007bff;
            color: #fff;
            border: none;
            padding: 10px 20px;
            border-radius: 4px;
            cursor: pointer;
            font-size: 14px;
        }
        .btn-submit:hover {
            background-color: #0056b3;
        }
        .btn-cancel {
            background-color: #ffc107;
            color: #fff;
            border: none;
            padding: 10px 20px;
            border-radius: 4px;
            cursor: pointer;
            font-size: 14px;
            text-decoration: none;
            display: inline-block;
            margin-left: 10px;
        }
        .btn-cancel:hover {
            background-color: #e0a800;
        }
    </style>
</head>
<body>
<th:block th:replace="~{/header.html}"></th:block>
<div class="container">
    <div class="receipt-form">
        <form th:action="@{'/buyer/updateReceipt/' + ${receipt.id}}" method="post">
            <input type="hidden" name="userId" th:value="${userId}"/>

            <div class="form-group">
                <label for="contactName">联系人</label>
                <input type="text" id="contactName" name="contactName"
                       th:value="${receipt.contactName}" required>
            </div>
            <div class="form-group">
                <label for="contactPhone">联系电话</label>
                <input type="text" id="contactPhone" name="contactPhone"
                       th:value="${receipt.contactPhone}" required>
            </div>
            <div class="form-group">
                <label for="deliveryAddress">收货地址</label>
                <textarea id="deliveryAddress" name="deliveryAddress" required
                          th:text="${receipt.deliveryAddress}"></textarea>
            </div>
            <div class="form-group">
                <label>
                    <input type="checkbox" name="isDefault" value="1"
                           th:checked="${receipt.isDefault} == 1"> 设为默认地址
                </label>
            </div>
            <div class="form-actions">
                <button type="submit" class="btn-submit">保存</button>
                <a th:href="@{/buyer/receipt}" class="btn-cancel">取消</a>
            </div>
        </form>
    </div>
</div>
<th:block th:replace="~{/footer.html}"></th:block>
<script src="/js/jquery-latest.min.js"></script>
<script src="/js/popper.min.js"></script>
<script src="/js/bootstrap.min.js"></script>
</body>
</html>